﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace Yugi.Client.ViewModel
{
    public class ChannelModel
    {
        public List<ChatModel> ListChannel;
        MainServerHandler main;

        public ChannelModel(MainServerHandler m)
        {
            main = m;
            Init();
        }

        public void Init()
        {
            ListChannel = new List<ChatModel>();
            ListChannel.Add(new ChatModel(main, ChatType.World));
            ListChannel.Add(new ChatModel(main, ChatType.Duel));
            ListChannel.Add(new ChatModel(main, ChatType.Trade));
            ListChannel.Add(new ChatModel(main, ChatType.Room));
            ListChannel.Add(new ChatModel(main, ChatType.Friend));
            ListChannel.Add(new ChatModel(main, ChatType.Group));
        }


        public void ReceiveMSG(ClientMSG msg, params object[] obj)
        {
            switch ((string)obj[0])
            {
                case "World":
                    ListChannel[0].AddText((string)obj[1], (string)obj[2]);
                    break;

                case "Duel":
                    ListChannel[1].AddText((string)obj[1], (string)obj[2]);
                    break;

                case "Trade":
                    ListChannel[2].AddText((string)obj[1], (string)obj[2]);
                    break;

                case "Room":
                    ListChannel[3].AddText((string)obj[1], (string)obj[2]);
                    break;

                case "Friend":
                    ListChannel[4].AddText((string)obj[1], (string)obj[2]);
                    break;

                case "Group":
                    ListChannel[5].AddText((string)obj[1], (string)obj[2]);
                    break;
            }
        }
    }
}
